﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace JForms
{
    public class ReturnView : Dictionary<string, object>
    {
    }

    public abstract class MvcView : Dictionary<string, object>
    {
        public ReturnView Updated { get; set; }

        public MvcView()
        {
            Updated = new ReturnView();
        }

        protected void Set<T>(string key, T value)
        {
            if (Updated.ContainsKey(key))
            {
                Updated.Add(key, value);
            }
            else
            {
                Updated[key] = value;
            }

            this[key] = value;
        }

        protected T Get<T>(string key)
        {
            return (T)this[key];
        }
    }
}